﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class DspbufferSet : MonoBehaviour
{
    public Dropdown dd;
    void OnEnable()
    {
        //dd.value = 
        int val = PlayerPrefs.GetInt("DspBuffer", 512);
        AudioSettings.SetDSPBufferSize(val,val);
        for(int i=0;i<dd.options.Count;i++)
        {
            if (dd.options[i].text.Trim() == val.ToString())
            {
                dd.value = i;
                break;
            }
        }
    }
    public void ChangeDsp()
    {
        int newDsp = int.Parse(dd.options[dd.value].text);
        PlayerPrefs.SetInt("DspBuffer", newDsp);
        AudioSettings.SetDSPBufferSize(newDsp, newDsp);
    }
}
